package com.bbc.fragment;

import android.view.MotionEvent;
import android.view.View;
import android.widget.RelativeLayout;

import com.bbc.R;
import com.bbc.base.BaseFragment;
import com.bbc.wigeth.BoomView;
import com.bbc.wigeth.LittleBall;
import com.bbc.wigeth.ParabolaView;

import java.util.List;

/**
 * Created by Administrator on 2017/9/26.
 */

public class QianFragment extends BaseFragment {

    private AnimEnd mAnimEnd;
    private BoomView boomView;
    private RelativeLayout rl;
    private ParabolaView parabolaView;

    @Override
    protected void setListeners() {

    }

    @Override
    protected void initData() {
        mAnimEnd = new AnimEnd();
        parabolaView.setmAnimEndInterface(mAnimEnd);
        rl.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_UP) {
                    parabolaView.startAnim((int) event.getX(), (int) event.getY());
                }
                return true;
            }
        });
    }

    class AnimEnd implements ParabolaView.AnimEndInterface {

        @Override
        public void onDrawBall(List<LittleBall> littleBalls) {
            boomView.startAnim(littleBalls);
        }

    }

    @Override
    protected void findViewId() {
        boomView = (BoomView) mView.findViewById(R.id.boomView);
        rl = (RelativeLayout) mView.findViewById(R.id.ll);
        parabolaView = (ParabolaView) mView.findViewById(R.id.parentPanel);
        //小红点的滑动
     /*   MyDrawCircleView circleView = (MyDrawCircleView) mView.findViewById(R.id.circle);
        ViewGroup parent = (ViewGroup) circleView.getParent();
        if (rl instanceof ViewGroup) {
            parent.removeAllViews();
        }
      *//*  if (parent != null) {
            parent.removeAllViews();
        }*//*
        rl.addView(circleView);*/

    }

    @Override
    protected int getViewLayou() {
        return R.layout.qian_fragment_myview;
    }

}
